<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 最大公约数
        function MaxDivisor ( a , b ) {
            var temp = a ; 
            if ( b > a ) {
                a = b ;
                b = temp ; 
            }
            while ( a % b != 0 ) {      //辗转相除法
                temp = b ; 
                b = a % b ; 
                a = temp ; 
            }
            return b ; 
        }
        //最小公倍数
        function MinMulti ( a , b ) {
            var res = MaxDivisor( a , b ) ;
            return a * b / res ;
        } 
        // 两个数之间的最小公倍数
        function AtoB(a,b){
            let res = 1 ; 
            for( let i = a ; i < b ; i ++ ){
                let min = MinMulti( i , i + 1 );
                res = MinMulti(res,min);
            }
            return res ;
        }
        console.log(AtoB(1,20));
        // 232792560
    </script>
</body>
</html>